home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 7 / Amiga Format AFCD07 (Dec 1996, Issue 91).iso / serious / shareware / programming / emacs-complete / fsf / emacs / info / emacs-18 < prev    next >
Encoding:
GNU Info File  |  1994-10-06  |  45.5 KB  |  1,057 lines

  1. This is Info file ../info/emacs, produced by Makeinfo-1.54 from the
  2. input file emacs.texi.
  3.  
  4. 
  5. File: emacs,  Node: Terminal Init,  Next: Find Init,  Prev: Init Examples,  Up: Init File
  6.  
  7. Terminal-specific Initialization
  8. --------------------------------
  9.  
  10.    Each terminal type can have a Lisp library to be loaded into Emacs
  11. when it is run on that type of terminal.  For a terminal type named
  12. TERMTYPE, the library is called `term/TERMTYPE' and it is found by
  13. searching the directories `load-path' as usual and trying the suffixes
  14. `.elc' and `.el'.  Normally it appears in the subdirectory `term' of
  15. the directory where most Emacs libraries are kept.
  16.  
  17.    The usual purpose of the terminal-specific library is to map the
  18. escape sequences used by the terminal's function keys onto more
  19. meaningful names, using `function-key-map'.  See the file
  20. `term/lk201.el' for an example of how this is done.  Many function keys
  21. are mapped automatically according to the information in the Termcap
  22. data base; the terminal-specific library needs to map only the function
  23. keys that Termcap does not specify.
  24.  
  25.    When the terminal type contains a hyphen, only the part of the name
  26. before the first hyphen is significant in choosing the library name.
  27. Thus, terminal types `aaa-48' and `aaa-30-rv' both use the library
  28. `term/aaa'.  The code in the library can use `(getenv "TERM")' to find
  29. the full terminal type name.
  30.  
  31.    The library's name is constructed by concatenating the value of the
  32. variable `term-file-prefix' and the terminal type.  Your `.emacs' file
  33. can prevent the loading of the terminal-specific library by setting
  34. `term-file-prefix' to `nil'.
  35.  
  36.    Emacs runs the hook `term-setup-hook' at the end of initialization,
  37. after both your `.emacs' file and any terminal-specific library have
  38. been read in.  Add hook functions to this hook if you wish to override
  39. part of any of the terminal-specific libraries and to define
  40. initializations for terminals that do not have a library.  *Note
  41. Hooks::.
  42.  
  43. 
  44. File: emacs,  Node: Find Init,  Prev: Terminal Init,  Up: Init File
  45.  
  46. How Emacs Finds Your Init File
  47. ------------------------------
  48.  
  49.    Normally Emacs uses the environment variable `HOME' to find
  50. `.emacs'; that's what `~' means in a file name.  But if you have done
  51. `su', Emacs tries to find your own `.emacs', not that of the user you
  52. are currently pretending to be.  The idea is that you should get your
  53. own editor customizations even if you are running as the super user.
  54.  
  55.    More precisely, Emacs first determines which user's init file to use.
  56. It gets the user name from the environment variables `LOGNAME' and
  57. `USER'; if neither of those exists, it uses effective user-ID.  If that
  58. user name matches the real user-ID, then Emacs uses `HOME'; otherwise,
  59. it looks up the home directory corresponding to that user name in the
  60. system's data base of users.
  61.  
  62. 
  63. File: emacs,  Node: Quitting,  Next: Lossage,  Prev: Customization,  Up: Top
  64.  
  65. Quitting and Aborting
  66. =====================
  67.  
  68. `C-g'
  69.      Quit.  Cancel running or partially typed command.
  70.  
  71. `C-]'
  72.      Abort innermost recursive editing level and cancel the command
  73.      which invoked it (`abort-recursive-edit').
  74.  
  75. `M-x top-level'
  76.      Abort all recursive editing levels that are currently executing.
  77.  
  78. `C-x u'
  79.      Cancel a previously made change in the buffer contents (`undo').
  80.  
  81.    There are two ways of canceling commands which are not finished
  82. executing: "quitting" with `C-g', and "aborting" with `C-]' or `M-x
  83. top-level'.  Quitting cancels a partially typed command or one which is
  84. already running.  Aborting exits a recursive editing level and cancels
  85. the command that invoked the recursive edit.  (*Note Recursive Edit::.)
  86.  
  87.    Quitting with `C-g' is used for getting rid of a partially typed
  88. command, or a numeric argument that you don't want.  It also stops a
  89. running command in the middle in a relatively safe way, so you can use
  90. it if you accidentally give a command which takes a long time.  In
  91. particular, it is safe to quit out of killing; either your text will
  92. *all* still be in the buffer, or it will *all* be in the kill ring (or
  93. maybe both).  Quitting an incremental search does special things
  94. documented under searching; in general, it may take two successive
  95. `C-g' characters to get out of a search (*note Incremental Search::.).
  96.  
  97.    `C-g' works by setting the variable `quit-flag' to `t' the instant
  98. `C-g' is typed; Emacs Lisp checks this variable frequently and quits if
  99. it is non-`nil'.  `C-g' is only actually executed as a command if you
  100. type it while Emacs is waiting for input.
  101.  
  102.    If you quit with `C-g' a second time before the first `C-g' is
  103. recognized, you activate the "emergency escape" feature and return to
  104. the shell.  *Note Emergency Escape::.
  105.  
  106.    There may be times when you cannot quit.  When Emacs is waiting for
  107. the operating system to do something, quitting is impossible unless
  108. special pains are taken for the particular system call within Emacs
  109. where the waiting occurs.  We have done this for the system calls that
  110. users are likely to want to quit from, but it's possible you will find
  111. another.  In one very common case--waiting for file input or output
  112. using NFS--Emacs itself knows how to quit, but most NFS implementations
  113. simply do not allow user programs to stop waiting for NFS when the NFS
  114. server is hung.
  115.  
  116.    Aborting with `C-]' (`abort-recursive-edit') is used to get out of a
  117. recursive editing level and cancel the command which invoked it.
  118. Quitting with `C-g' does not do this, and could not do this, because it
  119. is used to cancel a partially typed command *within* the recursive
  120. editing level.  Both operations are useful.  For example, if you are in
  121. a recursive edit and type `C-u 8' to enter a numeric argument, you can
  122. cancel that argument with `C-g' and remain in the recursive edit.
  123.  
  124.    The command `M-x top-level' is equivalent to "enough" `C-]' commands
  125. to get you out of all the levels of recursive edits that you are in.
  126. `C-]' gets you out one level at a time, but `M-x top-level' goes out
  127. all levels at once.  Both `C-]' and `M-x top-level' are like all other
  128. commands, and unlike `C-g', in that they take effect only when Emacs is
  129. ready for a command.  `C-]' is an ordinary key and has its meaning only
  130. because of its binding in the keymap.  *Note Recursive Edit::.
  131.  
  132.    `C-x u' (`undo') is not strictly speaking a way of canceling a
  133. command, but you can think of it as canceling a command that already
  134. finished executing.  *Note Undo::.
  135.  
  136. 
  137. File: emacs,  Node: Lossage,  Next: Bugs,  Prev: Quitting,  Up: Top
  138.  
  139. Dealing with Emacs Trouble
  140. ==========================
  141.  
  142.    This section describes various conditions in which Emacs fails to
  143. work normally, and how to recognize them and correct them.
  144.  
  145. * Menu:
  146.  
  147. * DEL Gets Help::       What to do if DEL doesn't delete.
  148. * Stuck Recursive::     `[...]' in mode line around the parentheses.
  149. * Screen Garbled::      Garbage on the screen.
  150. * Text Garbled::        Garbage in the text.
  151. * Unasked-for Search::  Spontaneous entry to incremental search.
  152. * Emergency Escape::    Emergency escape--
  153.                           What to do if Emacs stops responding.
  154. * Total Frustration::   When you are at your wits' end.
  155.  
  156. 
  157. File: emacs,  Node: DEL Gets Help,  Next: Stuck Recursive,  Up: Lossage
  158.  
  159. If DEL Fails to Delete
  160. ----------------------
  161.  
  162.    If you find that DEL enters Help like `Control-h' instead of
  163. deleting a character, your terminal is sending the wrong code for DEL.
  164. You can work around this problem by changing the keyboard translation
  165. table (*note Keyboard Translations::.).
  166.  
  167. 
  168. File: emacs,  Node: Stuck Recursive,  Next: Screen Garbled,  Prev: DEL Gets Help,  Up: Lossage
  169.  
  170. Recursive Editing Levels
  171. ------------------------
  172.  
  173.    Recursive editing levels are important and useful features of Emacs,
  174. but they can seem like malfunctions to the user who does not understand
  175. them.
  176.  
  177.    If the mode line has square brackets `[...]' around the parentheses
  178. that contain the names of the major and minor modes, you have entered a
  179. recursive editing level.  If you did not do this on purpose, or if you
  180. don't understand what that means, you should just get out of the
  181. recursive editing level.  To do so, type `M-x top-level'.  This is
  182. called getting back to top level.  *Note Recursive Edit::.
  183.  
  184. 
  185. File: emacs,  Node: Screen Garbled,  Next: Text Garbled,  Prev: Stuck Recursive,  Up: Lossage
  186.  
  187. Garbage on the Screen
  188. ---------------------
  189.  
  190.    If the data on the screen looks wrong, the first thing to do is see
  191. whether the text is really wrong.  Type `C-l', to redisplay the entire
  192. screen.  If the screen appears correct after this, the problem was
  193. entirely in the previous screen update.  (Otherwise, see *Note Text
  194. Garbled::.)
  195.  
  196.    Display updating problems often result from an incorrect termcap
  197. entry for the terminal you are using.  The file `etc/TERMS' in the Emacs
  198. distribution gives the fixes for known problems of this sort.
  199. `INSTALL' contains general advice for these problems in one of its
  200. sections.  Very likely there is simply insufficient padding for certain
  201. display operations.  To investigate the possibility that you have this
  202. sort of problem, try Emacs on another terminal made by a different
  203. manufacturer.  If problems happen frequently on one kind of terminal
  204. but not another kind, it is likely to be a bad termcap entry, though it
  205. could also be due to a bug in Emacs that appears for terminals that
  206. have or that lack specific features.
  207.  
  208. 
  209. File: emacs,  Node: Text Garbled,  Next: Unasked-for Search,  Prev: Screen Garbled,  Up: Lossage
  210.  
  211. Garbage in the Text
  212. -------------------
  213.  
  214.    If `C-l' shows that the text is wrong, try undoing the changes to it
  215. using `C-x u' until it gets back to a state you consider correct.  Also
  216. try `C-h l' to find out what command you typed to produce the observed
  217. results.
  218.  
  219.    If a large portion of text appears to be missing at the beginning or
  220. end of the buffer, check for the word `Narrow' in the mode line.  If it
  221. appears, the text you don't see is probably still present, but
  222. temporarily off-limits.  To make it accessible again, type `C-x n w'.
  223. *Note Narrowing::.
  224.  
  225. 
  226. File: emacs,  Node: Unasked-for Search,  Next: Emergency Escape,  Prev: Text Garbled,  Up: Lossage
  227.  
  228. Spontaneous Entry to Incremental Search
  229. ---------------------------------------
  230.  
  231.    If Emacs spontaneously displays `I-search:' at the bottom of the
  232. screen, it means that the terminal is sending `C-s' and `C-q' according
  233. to the poorly designed xon/xoff "flow control" protocol.
  234.  
  235.    If this happens to you, your best recourse is to put the terminal in
  236. a mode where it will not use flow control, or give it so much padding
  237. that it will never send a `C-s'.  (One way to increase the amount of
  238. padding is to set the variable `baud-rate' to a larger value.  Its
  239. value is the terminal output speed, measured in the conventional units
  240. of baud.)
  241.  
  242.    If you don't succeed in turning off flow control, the next best thing
  243. is to tell Emacs to cope with it.  To do this, call the function
  244. `enable-flow-control'.
  245.  
  246.    Typically there are particular terminal types with which you must use
  247. flow control.  You can conveniently ask for flow control on those
  248. terminal types only, using `enable-flow-control-on'.  For example, if
  249. you find you must use flow control on VT-100 and H19 terminals, put the
  250. following in your `.emacs' file:
  251.  
  252.      (enable-flow-control-on "vt100" "h19")
  253.  
  254.    When flow control is enabled, you must type `C-\' to get the effect
  255. of a `C-s', and type `C-^' to get the effect of a `C-q'.  (These
  256. aliases work by means of keyboard translations; see *Note Keyboard
  257. Translations::.)
  258.  
  259. 
  260. File: emacs,  Node: Emergency Escape,  Next: Total Frustration,  Prev: Unasked-for Search,  Up: Lossage
  261.  
  262. Emergency Escape
  263. ----------------
  264.  
  265.    Because at times there have been bugs causing Emacs to loop without
  266. checking `quit-flag', a special feature causes Emacs to be suspended
  267. immediately if you type a second `C-g' while the flag is already set,
  268. so you can always get out of GNU Emacs.  Normally Emacs recognizes and
  269. clears `quit-flag' (and quits!) quickly enough to prevent this from
  270. happening.
  271.  
  272.    When you resume Emacs after a suspension caused by multiple `C-g', it
  273. asks two questions before going back to what it had been doing:
  274.  
  275.      Auto-save? (y or n)
  276.      Abort (and dump core)? (y or n)
  277.  
  278. Answer each one with `y' or `n' followed by RET.
  279.  
  280.    Saying `y' to `Auto-save?' causes immediate auto-saving of all
  281. modified buffers in which auto-saving is enabled.
  282.  
  283.    Saying `y' to `Abort (and dump core)?' causes an illegal instruction
  284. to be executed, dumping core.  This is to enable a wizard to figure out
  285. why Emacs was failing to quit in the first place.  Execution does not
  286. continue after a core dump.  If you answer `n', execution does
  287. continue.  With luck, GNU Emacs will ultimately check `quit-flag' and
  288. quit normally.  If not, and you type another `C-g', it is suspended
  289. again.
  290.  
  291.    If Emacs is not really hung, just slow, you may invoke the double
  292. `C-g' feature without really meaning to.  Then just resume and answer
  293. `n' to both questions, and you will arrive at your former state.
  294. Presumably the quit you requested will happen soon.
  295.  
  296.    The double-`C-g' feature is turned off when Emacs is running under
  297. the X Window System, since you can use the window manager to kill Emacs
  298. or to create another window and run another program.
  299.  
  300. 
  301. File: emacs,  Node: Total Frustration,  Prev: Emergency Escape,  Up: Lossage
  302.  
  303. Help for Total Frustration
  304. --------------------------
  305.  
  306.    If using Emacs (or something else) becomes terribly frustrating and
  307. none of the techniques described above solve the problem, Emacs can
  308. still help you.
  309.  
  310.    First, if the Emacs you are using is not responding to commands, type
  311. `C-g C-g' to get out of it and then start a new one.
  312.  
  313.    Second, type `M-x doctor RET'.
  314.  
  315.    The doctor will help you feel better.  Each time you say something to
  316. the doctor, you must end it by typing RET RET.  This lets the doctor
  317. know you are finished.
  318.  
  319. 
  320. File: emacs,  Node: Bugs,  Next: Service,  Prev: Lossage,  Up: Top
  321.  
  322. Reporting Bugs
  323. ==============
  324.  
  325.    Sometimes you will encounter a bug in Emacs.  Although we cannot
  326. promise we can or will fix the bug, and we might not even agree that it
  327. is a bug, we want to hear about problems you encounter.  Often we agree
  328. they are bugs and want to fix them.
  329.  
  330.    To make it possible for us to fix a bug, you must report it.  In
  331. order to do so effectively, you must know when and how to do it.
  332.  
  333. * Menu:
  334.  
  335. * Criteria:  Bug Criteria.     Have you really found a bug?
  336. * Understanding Bug Reporting::     How to report a bug effectively.
  337. * Checklist::             Steps to follow for a good bug report.
  338. * Sending Patches::         How to send a patch for GNU Emacs.
  339.  
  340. 
  341. File: emacs,  Node: Bug Criteria,  Next: Understanding Bug Reporting,  Up: Bugs
  342.  
  343. When Is There a Bug
  344. -------------------
  345.  
  346.    If Emacs executes an illegal instruction, or dies with an operating
  347. system error message that indicates a problem in the program (as
  348. opposed to something like "disk full"), then it is certainly a bug.
  349.  
  350.    If Emacs updates the display in a way that does not correspond to
  351. what is in the buffer, then it is certainly a bug.  If a command seems
  352. to do the wrong thing but the problem corrects itself if you type
  353. `C-l', it is a case of incorrect display updating.
  354.  
  355.    Taking forever to complete a command can be a bug, but you must make
  356. certain that it was really Emacs's fault.  Some commands simply take a
  357. long time.  Type `C-g' and then `C-h l' to see whether the input Emacs
  358. received was what you intended to type; if the input was such that you
  359. *know* it should have been processed quickly, report a bug.  If you
  360. don't know whether the command should take a long time, find out by
  361. looking in the manual or by asking for assistance.
  362.  
  363.    If a command you are familiar with causes an Emacs error message in a
  364. case where its usual definition ought to be reasonable, it is probably a
  365. bug.
  366.  
  367.    If a command does the wrong thing, that is a bug.  But be sure you
  368. know for certain what it ought to have done.  If you aren't familiar
  369. with the command, or don't know for certain how the command is supposed
  370. to work, then it might actually be working right.  Rather than jumping
  371. to conclusions, show the problem to someone who knows for certain.
  372.  
  373.    Finally, a command's intended definition may not be best for editing
  374. with.  This is a very important sort of problem, but it is also a
  375. matter of judgment.  Also, it is easy to come to such a conclusion out
  376. of ignorance of some of the existing features.  It is probably best not
  377. to complain about such a problem until you have checked the
  378. documentation in the usual ways, feel confident that you understand it,
  379. and know for certain that what you want is not available.  If you are
  380. not sure what the command is supposed to do after a careful reading of
  381. the manual, check the index and glossary for any terms that may be
  382. unclear.
  383.  
  384.    If after careful rereading of the manual you still do not understand
  385. what the command should do, that indicates a bug in the manual, which
  386. you should report.  The manual's job is to make everything clear to
  387. people who are not Emacs experts--including you.  It is just as
  388. important to report documentation bugs as program bugs.
  389.  
  390.    If the on-line documentation string of a function or variable
  391. disagrees with the manual, one of them must be wrong; that is a bug.
  392.  
  393. 
  394. File: emacs,  Node: Understanding Bug Reporting,  Next: Checklist,  Prev: Bug Criteria,  Up: Bugs
  395.  
  396. Understanding Bug Reporting
  397. ---------------------------
  398.  
  399.    When you decide that there is a bug, it is important to report it
  400. and to report it in a way which is useful.  What is most useful is an
  401. exact description of what commands you type, starting with the shell
  402. command to run Emacs, until the problem happens.
  403.  
  404.    The most important principle in reporting a bug is to report *facts*,
  405. not hypotheses or categorizations.  It is always easier to report the
  406. facts, but people seem to prefer to strain to posit explanations and
  407. report them instead.  If the explanations are based on guesses about
  408. how Emacs is implemented, they will be useless; we will have to try to
  409. figure out what the facts must have been to lead to such speculations.
  410. Sometimes this is impossible.  But in any case, it is unnecessary work
  411. for us.
  412.  
  413.    For example, suppose that you type `C-x C-f /glorp/baz.ugh RET',
  414. visiting a file which (you know) happens to be rather large, and Emacs
  415. prints out `I feel pretty today'.  The best way to report the bug is
  416. with a sentence like the preceding one, because it gives all the facts
  417. and nothing but the facts.
  418.  
  419.    Do not assume that the problem is due to the size of the file and
  420. say, "When I visit a large file, Emacs prints out `I feel pretty
  421. today'." This is what we mean by "guessing explanations".  The problem
  422. is just as likely to be due to the fact that there is a `z' in the file
  423. name.  If this is so, then when we got your report, we would try out
  424. the problem with some "large file", probably with no `z' in its name,
  425. and not find anything wrong.  There is no way in the world that we
  426. could guess that we should try visiting a file with a `z' in its name.
  427.  
  428.    Alternatively, the problem might be due to the fact that the file
  429. starts with exactly 25 spaces.  For this reason, you should make sure
  430. that you inform us of the exact contents of any file that is needed to
  431. reproduce the bug.  What if the problem only occurs when you have typed
  432. the `C-x C-a' command previously?  This is why we ask you to give the
  433. exact sequence of characters you typed since starting the Emacs session.
  434.  
  435.    You should not even say "visit a file" instead of `C-x C-f' unless
  436. you *know* that it makes no difference which visiting command is used.
  437. Similarly, rather than saying "if I have three characters on the line,"
  438. say "after I type `RET A B C RET C-p'," if that is the way you entered
  439. the text.
  440.  
  441. 
  442. File: emacs,  Node: Checklist,  Next: Sending Patches,  Prev: Understanding Bug Reporting,  Up: Bugs
  443.  
  444. Checklist for Bug Reports
  445. -------------------------
  446.  
  447.    The best way to send a bug report is to mail it electronically to the
  448. Emacs maintainers at `bug-gnu-emacs@prep.ai.mit.edu'.  (If you want to
  449. suggest a change as an improvement, use the same address.)
  450.  
  451.    If you'd like to read the bug reports, you can find them on the
  452. newsgroup `gnu.emacs.bug'; keep in mind, however, that as a spectator
  453. you should not criticize anything about what you see there.  The
  454. purpose of bug reports is to give information to the Emacs maintainers.
  455. Spectators are welcome only as long as they do not interfere with
  456. this.  In particular, some bug reports contain large amounts of data;
  457. spectators should not complain about this.
  458.  
  459.    Please do not post bug reports using netnews; mail is more reliable
  460. than netnews about reporting your correct address, which we may need in
  461. order to ask you for more information.
  462.  
  463.    If you can't send electronic mail, then mail the bug report on paper
  464. or machine-readable media to this address:
  465.  
  466. GNU Emacs Bugs
  467. Free Software Foundation
  468. 675 Mass Ave
  469. Cambridge, MA 02139
  470.  
  471.    We do not promise to fix the bug; but if the bug is serious, or
  472. ugly, or easy to fix, chances are we will want to.
  473.  
  474.    To enable maintainers to investigate a bug, your report should
  475. include all these things:
  476.  
  477.    * The version number of Emacs.  Without this, we won't know whether
  478.      there is any point in looking for the bug in the current version
  479.      of GNU Emacs.
  480.  
  481.      You can get the version number by typing `M-x emacs-version RET'.
  482.      If that command does not work, you probably have something other
  483.      than GNU Emacs, so you will have to report the bug somewhere else.
  484.  
  485.    * The type of machine you are using, and the operating system name
  486.      and version number.
  487.  
  488.    * The operands you gave to the `configure' command when you installed
  489.      Emacs.
  490.  
  491.    * A complete list of any modifications you have made to the Emacs
  492.      source.  (We may not have time to investigate the bug unless it
  493.      happens in an unmodified Emacs.  But if you've made modifications
  494.      and you don't tell us, you are sending us on a wild goose chase.)
  495.  
  496.      Be precise about these changes.  A description in English is not
  497.      enough--send a context diff for them.
  498.  
  499.      Adding files of your own (such as a machine description for a
  500.      machine we don't support) is a modification of the source.
  501.  
  502.    * Details of any other deviations from the standard procedure for
  503.      installing GNU Emacs.
  504.  
  505.    * The complete text of any files needed to reproduce the bug.
  506.  
  507.      If you can tell us a way to cause the problem without visiting any
  508.      files, please do so.  This makes it much easier to debug.  If you
  509.      do need files, make sure you arrange for us to see their exact
  510.      contents.  For example, it can often matter whether there are
  511.      spaces at the ends of lines, or a newline after the last line in
  512.      the buffer (nothing ought to care whether the last line is
  513.      terminated, but try telling the bugs that).
  514.  
  515.    * The precise commands we need to type to reproduce the bug.
  516.  
  517.      The easy way to record the input to Emacs precisely is to to write
  518.      a dribble file.  To start the file, execute the Lisp expression
  519.  
  520.           (open-dribble-file "~/dribble")
  521.  
  522.      using `M-ESC' or from the `*scratch*' buffer just after starting
  523.      Emacs.  From then on, Emacs copies all your input to the specified
  524.      dribble file until the Emacs process is killed.
  525.  
  526.    * For possible display bugs, the terminal type (the value of
  527.      environment variable `TERM'), the complete termcap entry for the
  528.      terminal from `/etc/termcap' (since that file is not identical on
  529.      all machines), and the output that Emacs actually sent to the
  530.      terminal.
  531.  
  532.      The way to collect the terminal output is to execute the Lisp
  533.      expression
  534.  
  535.           (open-termscript "~/termscript")
  536.  
  537.      using `M-ESC' or from the `*scratch*' buffer just after starting
  538.      Emacs.  From then on, Emacs copies all terminal output to the
  539.      specified termscript file as well, until the Emacs process is
  540.      killed.  If the problem happens when Emacs starts up, put this
  541.      expression into your `.emacs' file so that the termscript file
  542.      will be open when Emacs displays the screen for the first time.
  543.  
  544.      Be warned: it is often difficult, and sometimes impossible, to fix
  545.      a terminal-dependent bug without access to a terminal of the type
  546.      that stimulates the bug.
  547.  
  548.    * A description of what behavior you observe that you believe is
  549.      incorrect.  For example, "The Emacs process gets a fatal signal,"
  550.      or, "The resulting text is as follows, which I think is wrong."
  551.  
  552.      Of course, if the bug is that Emacs gets a fatal signal, then one
  553.      can't miss it.  But if the bug is incorrect text, the maintainer
  554.      might fail to notice what is wrong.  Why leave it to chance?
  555.  
  556.      Even if the problem you experience is a fatal signal, you should
  557.      still say so explicitly.  Suppose something strange is going on,
  558.      such as, your copy of the source is out of sync, or you have
  559.      encountered a bug in the C library on your system.  (This has
  560.      happened!)  Your copy might crash and the copy here might not.  If
  561.      you *said* to expect a crash, then when Emacs here fails to crash,
  562.      we would know that the bug was not happening.  If you don't say to
  563.      expect a crash, then we would not know whether the bug was
  564.      happening--we would not be able to draw any conclusion from our
  565.      observations.
  566.  
  567.      If the manifestation of the bug is an Emacs error message, it is
  568.      important to report not just the text of the error message but a
  569.      backtrace showing how the Lisp program in Emacs arrived at the
  570.      error.  To make the backtrace, execute the Lisp expression `(setq
  571.      debug-on-error t)' before the error happens (that is to say, you
  572.      must execute that expression and then make the bug happen).  This
  573.      causes the Lisp debugger to run, showing you a backtrace.  Copy
  574.      the text of the debugger's backtrace into the bug report.
  575.  
  576.      This use of the debugger is possible only if you know how to make
  577.      the bug happen again.  Do note the error message the first time
  578.      the bug happens, so if you can't make it happen again, you can
  579.      report at least the error message.
  580.  
  581.    * Check whether any programs you have loaded into the Lisp world,
  582.      including your `.emacs' file, set any variables that may affect the
  583.      functioning of Emacs.  Also, see whether the problem happens in a
  584.      freshly started Emacs without loading your `.emacs' file (start
  585.      Emacs with the `-q' switch to prevent loading the init file.)  If
  586.      the problem does *not* occur then, you must report the precise
  587.      contents of any programs that you must load into the Lisp world in
  588.      order to cause the problem to occur.
  589.  
  590.    * If the problem does depend on an init file or other Lisp programs
  591.      that are not part of the standard Emacs system, then you should
  592.      make sure it is not a bug in those programs by complaining to
  593.      their maintainers first.  After they verify that they are using
  594.      Emacs in a way that is supposed to work, they should report the
  595.      bug.
  596.  
  597.    * If you wish to mention something in the GNU Emacs source, show the
  598.      line of code with a few lines of context.  Don't just give a line
  599.      number.
  600.  
  601.      The line numbers in the development sources don't match those in
  602.      your sources.  It would take extra work for the maintainers to
  603.      determine what code is in your version at a given line number, and
  604.      we could not be certain.
  605.  
  606.    * Additional information from a C debugger such as GDB might enable
  607.      someone to find a problem on a machine which he does not have
  608.      available.  However, you need to think when you collect this
  609.      information if you want it to be useful.
  610.  
  611.      For example, many people send just a backtrace, but that is not
  612.      very useful by itself.  A simple backtrace with arguments often
  613.      conveys little about what is happening inside GNU Emacs, because
  614.      most of the arguments listed in the backtrace are pointers to Lisp
  615.      objects.  The numeric values of these pointers have no
  616.      significance whatever; all that matters is the contents of the
  617.      objects they point to (and most of the contents are themselves
  618.      pointers).
  619.  
  620.      To provide useful information, you need to show the values of Lisp
  621.      objects in Lisp notation.  Do this for each variable which is a
  622.      Lisp object, in several stack frames near the bottom of the stack.
  623.      Look at the source to see which variables are Lisp objects,
  624.      because the debugger thinks of them as integers.
  625.  
  626.      To show a variable's value in Lisp syntax, first print its value,
  627.      then use the user-defined GDB command `pr' to print the Lisp
  628.      object in Lisp syntax.  (If you must use another debugger, call
  629.      the function `debug_print' with the object as an argument.)  The
  630.      `pr' command is defined by the file `src/.gdbinit' in the Emacs
  631.      distribution, and it works only if you are debugging a running
  632.      process (not with a core dump).
  633.  
  634.      To make Lisp errors stop Emacs and return to GDB, put a breakpoint
  635.      at `Fsignal'.
  636.  
  637.      To find out which Lisp functions are running, using GDB, move up
  638.      the stack, and each time you get to a frame for the function
  639.      `Ffuncall', type these GDB commands:
  640.  
  641.           p *args
  642.           pr
  643.  
  644.      To print the first argument that the function received, use these
  645.      commands:
  646.  
  647.           p args[1]
  648.           pr
  649.  
  650.      You can print the other arguments likewise.  The argument `nargs'
  651.      of `Ffuncall' says how many arguments `Ffuncall' received; these
  652.      include the Lisp function itself and the arguments for that
  653.      function.
  654.  
  655.    Here are some things that are not necessary in a bug report:
  656.  
  657.    * A description of the envelope of the bug--this is not necessary
  658.      for a reproducible bug.
  659.  
  660.      Often people who encounter a bug spend a lot of time investigating
  661.      which changes to the input file will make the bug go away and which
  662.      changes will not affect it.
  663.  
  664.      This is often time consuming and not very useful, because the way
  665.      we will find the bug is by running a single example under the
  666.      debugger with breakpoints, not by pure deduction from a series of
  667.      examples.  You might as well save time by not searching for
  668.      additional examples.
  669.  
  670.      Of course, if you can find a simpler example to report *instead* of
  671.      the original one, that is a convenience.  Errors in the output
  672.      will be easier to spot, running under the debugger will take less
  673.      time, etc.
  674.  
  675.      However, simplification is not vital; if you can't do this or
  676.      don't have time to try, please report the bug with your original
  677.      test case.
  678.  
  679.    * A system call trace of Emacs execution.
  680.  
  681.      System call traces are very useful for certain special kinds of
  682.      debugging, but in most cases they give little useful information.
  683.      It is therefore strange that many people seem to think that *the*
  684.      way to report information about a crash is to send a system call
  685.      trace.
  686.  
  687.      In most programs, a backtrace is normally far, far more
  688.      informative than a system call trace.  Even in Emacs, a simple
  689.      backtrace is generally more informative, though to give full
  690.      information you should supplement the backtrace by displaying
  691.      variable values and printing them as Lisp objects with `pr' (see
  692.      above).
  693.  
  694.    * A patch for the bug.
  695.  
  696.      A patch for the bug is useful if it is a good one.  But don't omit
  697.      the other information that a bug report needs, such as the test
  698.      case, on the assumption that a patch is sufficient.  We might see
  699.      problems with your patch and decide to fix the problem another
  700.      way, or we might not understand it at all.  And if we can't
  701.      understand what bug you are trying to fix, or why your patch
  702.      should be an improvement, we mustn't install it.
  703.  
  704.      *Note Sending Patches::, for guidelines on how to make it easy for
  705.      us to understand and install your patches.
  706.  
  707.    * A guess about what the bug is or what it depends on.
  708.  
  709.      Such guesses are usually wrong.  Even experts can't guess right
  710.      about such things without first using the debugger to find the
  711.      facts.
  712.  
  713. 
  714. File: emacs,  Node: Sending Patches,  Prev: Checklist,  Up: Bugs
  715.  
  716. Sending Patches for GNU Emacs
  717. -----------------------------
  718.  
  719.    If you would like to write bug fixes or improvements for GNU Emacs,
  720. that is very helpful.  When you send your changes, please follow these
  721. guidelines to make it easy for the maintainers to use them.  If you
  722. don't follow these guidelines, your information might still be useful,
  723. but using it will take extra work.  Maintaining GNU Emacs is a lot of
  724. work in the best of circumstances, and we can't keep up unless you do
  725. your best to help.
  726.  
  727.    * Send an explanation with your changes of what problem they fix or
  728.      what improvement they bring about.  For a bug fix, just include a
  729.      copy of the bug report, and explain why the change fixes the bug.
  730.  
  731.      (Referring to a bug report is not as good as including it, because
  732.      then we will have to look it up, and we have probably already
  733.      deleted it if we've already fixed the bug.)
  734.  
  735.    * Always include a proper bug report for the problem you think you
  736.      have fixed.  We need to convince ourselves that the change is
  737.      right before installing it.  Even if it is correct, we might have
  738.      trouble understanding it if we don't have a way to reproduce the
  739.      problem.
  740.  
  741.    * Include all the comments that are appropriate to help people
  742.      reading the source in the future understand why this change was
  743.      needed.
  744.  
  745.    * Don't mix together changes made for different reasons.  Send them
  746.      *individually*.
  747.  
  748.      If you make two changes for separate reasons, then we might not
  749.      want to install them both.  We might want to install just one.  If
  750.      you send them all jumbled together in a single set of diffs, we
  751.      have to do extra work to disentangle them--to figure out which
  752.      parts of the change serve which purpose.  If we don't have time
  753.      for this, we might have to ignore your changes entirely.
  754.  
  755.      If you send each change as soon as you have written it, with its
  756.      own explanation, then two changes never get tangled up, and we can
  757.      consider each one properly without any extra work to disentangle
  758.      them.
  759.  
  760.    * Send each change as soon as that change is finished.  Sometimes
  761.      people think they are helping us by accumulating many changes to
  762.      send them all together.  As explained above, this is absolutely
  763.      the worst thing you could do.
  764.  
  765.      Since you should send each change separately, you might as well
  766.      send it right away.  That gives us the option of installing it
  767.      immediately if it is important.
  768.  
  769.    * Use `diff -c' to make your diffs.  Diffs without context are hard
  770.      to install reliably.  More than that, they are hard to study; we
  771.      must always study a patch to decide whether we want to install it.
  772.      Unidiff format is better than contextless diffs, but not as easy
  773.      to read as `-c' format.
  774.  
  775.      If you have GNU diff, use `diff -c -F'^[_a-zA-Z0-9$]+ *('' when
  776.      making diffs of C code.  This shows the name of the function that
  777.      each change occurs in.
  778.  
  779.    * Write the change log entries for your changes.  This is both to
  780.      save us the extra work of writing them, and to help explain your
  781.      changes so we can understand them.
  782.  
  783.      The purpose of the change log is to show people where to find what
  784.      was changed.  So you need to be specific about what functions you
  785.      changed; in large functions, it's often helpful to indicate where
  786.      within the function the change was.
  787.  
  788.      On the other hand, once you have shown people where to find the
  789.      change, you need not explain its purpose in the change log.  Thus,
  790.      if you add a new function, all you need to say about it is that it
  791.      is new.  If you feel that the purpose needs explaining, it
  792.      probably does--but put the explanation in comments in the code.
  793.      It will be more useful there.
  794.  
  795.      Please read the `ChangeLog' files in the `src' and `lisp'
  796.      directories to see what sorts of information to put in, and to
  797.      learn the style that we use.  If you would like your name to
  798.      appear in the header line, showing who made the change, send us
  799.      the header line.  *Note Change Log::.
  800.  
  801.    * When you write the fix, keep in mind that we can't install a
  802.      change that would break other systems.  Please think about what
  803.      effect your change will have if compiled on another type of system.
  804.  
  805.      Sometimes people send fixes that *might* be an improvement in
  806.      general--but it is hard to be sure of this.  It's hard to install
  807.      such changes because we have to study them very carefully.  Of
  808.      course, a good explanation of the reasoning by which you concluded
  809.      the change was correct can help convince us.
  810.  
  811.      The safest changes are changes to the configuration files for a
  812.      particular machine.  These are safe because they can't create new
  813.      bugs on other machines.
  814.  
  815.      Please help us keep up with the workload by designing the patch in
  816.      a form that is clearly safe to install.
  817.  
  818. 
  819. File: emacs,  Node: Service,  Next: Command Arguments,  Prev: Bugs,  Up: Top
  820.  
  821. How To Get Help with GNU Emacs
  822. ==============================
  823.  
  824.    If you need help installing, using or changing GNU Emacs, there are
  825. two ways to find it:
  826.  
  827.    * Send a message to a suitable network mailing list.  First try
  828.      `bug-gnu-emacs@prep.ai.mit.edu', and if that brings no response,
  829.      try `help-gnu-emacs@prep.ai.mit.edu'.
  830.  
  831.    * Look in the service directory for someone who might help you for a
  832.      fee.  The service directory is found in the file named
  833.      `etc/SERVICE' in the Emacs distribution.
  834.  
  835. 
  836. File: emacs,  Node: Command Arguments,  Next: Antinews,  Prev: Service,  Up: Top
  837.  
  838. Command Line Arguments
  839. **********************
  840.  
  841.    GNU Emacs supports command line arguments to request various actions
  842. when invoking Emacs.  These are for compatibility with other editors and
  843. for sophisticated activities.  We don't recommend using them for
  844. ordinary editing.
  845.  
  846.    Arguments starting with `-' are "options".  Other arguments specify
  847. files to visit.  Emacs visits the specified files while it starts up.
  848. The last file name on your command line becomes the current buffer; the
  849. other files are also present in other buffers.
  850.  
  851.    You can use options to specify various other things, such as the size
  852. and position of the X window Emacs uses, its colors, and so on.  A few
  853. options support advanced usage, such as running Lisp functions on files
  854. in batch mode.
  855.  
  856.    There are two kinds of options: "initial options" and "ordinary
  857. options".  Initial options must come at the beginning of the command
  858. line, in a particular order.  Ordinary options come afterward; they can
  859. appear in any order and can be intermixed with file names to visit.
  860. These and file names are called "ordinary arguments".  Emacs processes
  861. all of these in the order they are written.
  862.  
  863. * Menu:
  864.  
  865. * Ordinary Arguments::    Arguments to visit files, load libraries,
  866.               and call functions.
  867. * Initial Options::     Arguments that must come at the start of the command.
  868. * Command Example::     Examples of using command line arguments.
  869. * Resume Arguments::    Specifying arguments when you resume a running Emacs.
  870. * Environment::         Environment variables that Emacs uses.
  871.  
  872. * Display X::           Changing the default display and using remote login.
  873. * Font X::            Choosing a font for text, under X.
  874. * Colors X::            Choosing colors, under X.
  875. * Window Size X::       Start-up window size, under X.
  876. * Borders X::            Internal and external borders, under X.
  877. * Icons X::             Choosing what sort of icon to use, under X.
  878. * Resources X::         Advanced use of classes and resources, under X.
  879.  
  880. 
  881. File: emacs,  Node: Ordinary Arguments,  Next: Initial Options,  Up: Command Arguments
  882.  
  883. Ordinary Arguments
  884. ==================
  885.  
  886.    Here is a table of the ordinary arguments and options:
  887.  
  888. `FILE'
  889.      Visit FILE using `find-file'.  *Note Visiting::.
  890.  
  891. `+LINENUM FILE'
  892.      Visit FILE using `find-file', then go to line number LINENUM in it.
  893.  
  894. `-l FILE'
  895. `-load FILE'
  896.      Load a file FILE of Lisp code with the function `load'.  *Note
  897.      Lisp Libraries::.
  898.  
  899. `-f FUNCTION'
  900. `-funcall FUNCTION'
  901.      Call Lisp function FUNCTION with no arguments.
  902.  
  903. `-insert FILE'
  904.      Insert the contents of FILE into the current buffer.  This is like
  905.      what `M-x insert-file' does; *Note Misc File Ops::.
  906.  
  907. `-kill'
  908.      Exit from Emacs without asking for confirmation.
  909.  
  910. 
  911. File: emacs,  Node: Initial Options,  Next: Command Example,  Prev: Ordinary Arguments,  Up: Command Arguments
  912.  
  913. Initial Options
  914. ===============
  915.  
  916.    The initial options are recognized only at the beginning of the
  917. command line.  If you use more than one of them, they must appear in the
  918. order that they appear in this table.
  919.  
  920. `-t DEVICE'
  921.      Use DEVICE as the device for terminal input and output.
  922.  
  923. `-d DISPLAY'
  924.      When running with the X Window System, use the display named
  925.      DISPLAY to make the window that serves as Emacs's terminal.
  926.  
  927. `-nw'
  928.      Don't communicate directly with X, disregarding the `DISPLAY'
  929.      environment variable even if it is set.  `-nw' stands for
  930.      "non-window."
  931.  
  932. `-batch'
  933.      Run Emacs in "batch mode", which means that the text being edited
  934.      is not displayed and the standard terminal interrupt characters
  935.      such as `C-z' and `C-c' continue to have their normal effect.
  936.      Emacs in batch mode outputs to `stderr' only what would normally
  937.      be printed in the echo area under program control.
  938.  
  939.      Batch mode is used for running programs written in Emacs Lisp from
  940.      shell scripts, makefiles, and so on.  Normally the `-l' option or
  941.      `-f' option will be used as well, to invoke a Lisp program to do
  942.      the batch processing.
  943.  
  944.      `-batch' implies `-q' (do not load an init file).  It also causes
  945.      Emacs to kill itself after all command options have been
  946.      processed.  In addition, auto-saving is not done except in buffers
  947.      for which it has been explicitly requested.
  948.  
  949. `-q'
  950. `-no-init-file'
  951.      Do not load your Emacs init file `~/.emacs'.
  952.  
  953. `-no-site-file'
  954.      Do not load `site-start.el'.  (This file is normally loaded before
  955.      `~/.emacs'.)
  956.  
  957. `-u USER'
  958. `-user USER'
  959.      Load USER's Emacs init file `~USER/.emacs' instead of your own.
  960.  
  961. `-debug-init'
  962.      Enable the Emacs Lisp debugger for errors in the init file.
  963.  
  964.    The init file can access the values of the command line arguments as
  965. the elements of a list in the variable `command-line-args'.  (The list
  966. contains only the ordinary arguments; Emacs processes the initial
  967. arguments before building the list.)  The init file can override the
  968. normal processing of the ordinary arguments by setting this variable.
  969.  
  970. 
  971. File: emacs,  Node: Command Example,  Next: Resume Arguments,  Prev: Initial Options,  Up: Command Arguments
  972.  
  973. Command Argument Example
  974. ========================
  975.  
  976.    Here is an example of using Emacs with arguments and options.  It
  977. assumes you have a Lisp program file called `hack-c.el' which, when
  978. loaded, performs some useful operation on current buffer, expected to be
  979. a C program.
  980.  
  981.      emacs -batch foo.c -l hack-c -f save-buffer -kill >& log
  982.  
  983. This says to visit `foo.c', load `hack-c.el' (which makes changes in
  984. the visited file), save `foo.c' (note that `save-buffer' is the
  985. function that `C-x C-s' is bound to), and then exit to the shell that
  986. this command was done with.  The initial option `-batch' guarantees
  987. there will be no problem redirecting output to `log', because Emacs
  988. will not assume that it has a display terminal to work with.
  989.  
  990. 
  991. File: emacs,  Node: Resume Arguments,  Next: Environment,  Prev: Command Example,  Up: Command Arguments
  992.  
  993. Resuming Emacs with Arguments
  994. =============================
  995.  
  996.    You can specify ordinary arguments for Emacs when you resume it after
  997. a suspension.  To prepare for this, put the following code in your
  998. `.emacs' file (*note Hooks::.):
  999.  
  1000.      (add-hook 'suspend-hook 'resume-suspend-hook)
  1001.  
  1002.    As further preparation, you must execute the shell script
  1003. `emacs.csh' (if you use csh as your shell) or `emacs.bash' (if you use
  1004. bash as your shell).  These scripts define an alias named `edit', which
  1005. will resume Emacs giving it new command line arguments such as files to
  1006. visit.
  1007.  
  1008.    Only ordinary arguments work properly when you resume Emacs.  Initial
  1009. arguments are not recognized--it's too late to execute them anyway.
  1010.  
  1011.    Note that resuming Emacs (with or without arguments) must be done
  1012. from within the shell that is the parent of the Emacs job.  This is why
  1013. `edit' is an alias rather than a program or a shell script.  It is not
  1014. possible to implement a resumption command that could be run from other
  1015. subjobs of the shell; no way to define a command that could be made the
  1016. value of `EDITOR', for example.  Therefore, this feature does not take
  1017. the place of the the Emacs Server feature.  *Note Emacs Server::.
  1018.  
  1019.    The aliases use the Emacs Server feature if you appear to have a
  1020. server Emacs running.  However, they cannot determine this with complete
  1021. accuracy.  They may think that a server is still running when in
  1022. actuality you have killed that Emacs, because the file `/tmp/.esrv...'
  1023. still exists.  If this happens, find that file and delete it.
  1024.  
  1025. 
  1026. File: emacs,  Node: Environment,  Next: Display X,  Prev: Resume Arguments,  Up: Command Arguments
  1027.  
  1028. Environment Variables
  1029. =====================
  1030.  
  1031.    This appendix describes how Emacs uses environment variables.  An
  1032. environment variable is a string passed from the operating system to
  1033. Emacs, and the collection of environment variables is known as the
  1034. environment.  Environment variable names are case sensitive and it is
  1035. conventional to use upper case letters only.
  1036.  
  1037.    Because environment variables come from the operating system there
  1038. is no general way to set them; it depends on the operating system and
  1039. especially the shell that you are using.  For example, here's how to set
  1040. the environment variable `ORGANIZATION' to `not very much' using bash:
  1041.  
  1042.      export ORGANIZATION="not very much"
  1043.  
  1044. and here's how to do it in csh or tcsh:
  1045.  
  1046.      setenv ORGANIZATION "not very much"
  1047.  
  1048.    When Emacs is set-up to use the X windowing system, it inherits the
  1049. use of a large number of environment variables from the X library.  See
  1050. the X documentation for more information.
  1051.  
  1052. * Menu:
  1053.  
  1054. * General Variables::     Environment variables that all versions of Emacs use.
  1055. * Misc Variables::        Certain system specific variables.
  1056.  
  1057.